Skip to content

feat(dincli): deploy sets DinToken and defaults --model-id (task_061026_21 Part C, Deploy) - #314

Merged
Santiagocetran merged 1 commit into
InfiniteZeroFoundation:developfrom
umermjd11:feat/task-061026-21-deploy-din-token
Nov 6, 2026
Merged

Santiagocetran merged 1 commit into
InfiniteZeroFoundation:developfrom
umermjd11:feat/task-061026-21-deploy-din-token

Conversation

@umermjd11

Copy link
Copy Markdown
Collaborator

Summary

task_061026_21 Part C, Deploy: the follow-up that #302 deferred until #261 merged. Spec: Developer/tasks/task_061026_21.md (Deploy, BL-27). Tracking: Discussion #231.

Part D (#313) depends on this. Without setDinToken, rewards deposit refuses, so the integration suite can't fund or start a GI.

Changes (dincli/cli/modelownerd/deploy.py)

  • setDinToken: deploy task-coordinator and deploy task-auditor each call setDinToken(din_info token) on the new contract. The auditor does this before setDINTaskAuditorContract.
  • --model-id is optional:
  • The NameError is fixed: a missing stake or token din_info entry now exits with a clear message before any transaction is sent.

Docs: DINTaskCoordinator.md §10 No. 10 and DINTaskAuditor.md §13 No. 8 had said dincli still used the pre-modelId constructors, which has been wrong since #261. They now describe the deploy as it is.

For review

  • Deviation from the spec: it says both deploys default to totalModels(). For the auditor, I default to the coordinator's modelId() instead. If another approval landed between the two deploys, totalModels() would move, and the auditor would then refuse its own coordinator.

Tests

tests/test_deploy_task_contracts.py (8 tests) covers:

  • the coordinator default with its warning, and that an explicit ID skips the registry
  • the auditor default
  • the tx order: constructor → setDinToken (→ setDINTaskAuditorContract)
  • missing stake or token exits before any tx

test_task_auditor_model_id_guard.py: its mocks now take the address argument and a token entry.

pytest -m "not integration"
843 passed, 133 deselected

🤖 Generated with Claude Code

…26_21 Part C, Deploy)

The deploy follow-up PR InfiniteZeroFoundation#302 deferred until InfiniteZeroFoundation#261 merged:

- `model-owner deploy task-coordinator` and `task-auditor` call
  setDinToken(din_info token) on the new contract. Without it,
  `rewards deposit` refuses and no GI can be funded or started.
- `--model-id` is optional. The coordinator defaults to
  DINModelRegistry.totalModels() (the ID the next approval assigns) and
  warns that this only holds if no other request is approved first. The
  auditor defaults to the coordinator's modelId(); the mismatch guard
  from InfiniteZeroFoundation#261 is unchanged.
- A missing `stake` or `token` din_info entry exits with a clear message
  before any transaction, instead of a NameError.

DINTaskCoordinator.md §10 No. 10 and DINTaskAuditor.md §13 No. 8 now
describe the fixed deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
umermjd11 added a commit to umermjd11/DevNet that referenced this pull request Nov 5, 2026
… every phase

task_061026_21 Part D, Decision 3. test_04_gi.py now:
- funds GI 1 (model owner buys DIN, `rewards deposit`) before `gi start`;
- registers each auditor's encryption key, and checks an aggregator can't
  also register as an auditor (task_061026_20 Part B, InfiniteZeroFoundation#180);
- adds the seed and test-data states: `auditor lock-seed` (AuditSeedLocked),
  `create-testdataset --submit` (AuditTestDataAssigned), `aggregator
  lock-seed` (AggSeedLocked);
- adds the three reveal windows: `start-reveal` + per-validator reveal for
  LMS evaluation, T1 and T2; then `T2 set-score`;
- asserts the GI state by name after every phase. `_gi_state` now parses
  "Global iteration state: <name>" (it used to return the first non-markup
  line, i.e. the contract-address banner). The end state is GIended by name
  and ordinal 28, with no `or "23"` fallback;
- claims and withdraws GI 1's reward for one client, one auditor and one
  aggregator, checking each DIN balance rises, then `gi release-slots`.

test_02: the deploys leave --model-id to its default and check that DinToken
was set on both contracts (needs InfiniteZeroFoundation#314). The deployed address is taken from
the "deployed at" line, not the first 0x… line (the stake address).

conftest: COLUMNS=250 for dincli subprocesses, so Rich doesn't wrap the
lines the suite matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Collaborator

Reviewed PR No. 314 at 24be72b against merge-base ae7e8d6.

At the last conflict check, develop was 1d3b484, 11 commits beyond the merge-base, with no changes to this PR’s five files. Local git merge-tree --write-tree reported a clean merge; GitHub reported MERGEABLE.

CI OK passed. The Python job reports 843 passed, 133 deselected. Docs and Solidity jobs also passed.

Claimed: Both deployment commands configure DinToken, with the auditor configured before pairing.

Verified against local Anvil: Built the exact PR commit using Solidity 0.8.28 and the repository’s via_ir configuration, then deployed the platform through its canonical Foundry script. Ran both actual dincli task deployment commands without mocked contract calls or transaction submission.

Transaction receipts confirmed:

  • Coordinator: constructor → setDinToken.
  • Auditor: constructor → setDinToken → setDINTaskAuditorContract.

All transactions succeeded. On-chain reads confirmed both token addresses, ownership, stake dependencies, and the coordinator–auditor link in both directions.

Claimed: Model IDs default correctly while explicit IDs and mismatch protection remain supported.

Verified: On Anvil, the coordinator default matched registry totalModels() and printed the approval-order warning. The auditor inherited the coordinator’s ID. An explicitly mismatched auditor ID exited without sending a transaction. An explicit coordinator ID of 7 was honored while the registry counter was 1.

The auditor’s documented deviation from the spec is justified: reading its coordinator’s immutable ID avoids an unnecessary mismatch if another registration is approved between deployments.

Claimed: Token setup enables reward funding.

Verified against local Anvil: Registered the deployed model, acquired disposable test DIN, and ran:

dincli --network local --demokey 1 model-owner rewards deposit 0 --gi 1 --amount 10

Receipts confirmed approval followed by depositRewards. GI 1’s reward pool increased by exactly 10 DIN, the owner’s balance decreased by exactly 10 DIN, and the auditor received exactly 10 DIN.

The test used an isolated manifest cache; it did not require an IPFS service.

Claimed: Missing stake/token entries fail clearly before transactions, and documentation reflects the new deployment behavior.

Verified: The focused unit tests cover missing stake for both commands and missing token for the auditor, with no transactions sent. Source inspection confirms both commands use the shared required-address helper. Both documentation updates match the implementation, and the Docs check passed.

Independent verification summary:

  • Deployment, model-ID guard, registry approval, and rewards unit tests: 43 passed.
  • Remote Anvil smoke run on agent@10.10.20.37: 21 checks passed.
  • Anvil stopped after the run; the review worktree remained clean.
  • Full GI execution was not part of this focused deployment smoke test.

Scope and closing keywords: This completes the deployment follow-up, rather than all of task_061026_21 Part C. Neither the reviewed PR body nor its commit message contains an issue-closing directive.

No actionable findings. The previously pending deployment and reward-funding verification is complete. Recommend approval and merge as-is through the normal merge queue.

Copy link
Copy Markdown
Collaborator

Files changed (5) — as of 24be72b

Compared against merge-base ae7e8d6. At the last check, develop (1d3b484) had advanced by 11 commits without changing these files. Local and GitHub conflict analysis agreed: no conflicts.

dincli/cli/modelownerd/deploy.py

Field Value
Change Modified
Lines +62/-12
Diff Adds required-address and token-setting helpers; makes model IDs optional; configures both deployed contracts’ token addresses.
Functionality — how & why How: Coordinator defaults to registry totalModels() with a warning. Auditor defaults to coordinator modelId(), retains mismatch refusal, and sets its token before pairing. Why: Completes deployment setup for rewards/bonds and rejects missing stake/token configuration before transactions.
Diff vs current develop HEAD Untouched since merge-base at the last check.
Recommended merge proposal Merge as-is. Actual CLI deployments, transaction order, token setup, pairing, ID handling, and reward funding passed on Anvil.
Actual merge proposal Soon
Pending proposal None.
Local merge conflict No
GitHub merge conflict No

tests/test_deploy_task_contracts.py

Field Value
Change New
Lines +154/-0
Diff Adds eight deployment tests.
Functionality — how & why How: Records mocked constructor arguments and transaction order; exercises defaults and missing-address failures. Why: Provides repeatable unit coverage of deployment setup.
Diff vs current develop HEAD File absent on develop at the last check.
Recommended merge proposal Merge as-is; all eight tests pass. Actual deployment behavior was also checked on Anvil.
Actual merge proposal Soon
Pending proposal None.
Local merge conflict No
GitHub merge conflict No

tests/test_task_auditor_model_id_guard.py

Field Value
Change Modified
Lines +7/-3
Diff Updates mocks for deployed-contract addresses, token setup, and the context signature.
Functionality — how & why How: Supplies dependencies required by the updated deployment. Why: Preserves the existing model-ID mismatch regression coverage.
Diff vs current develop HEAD Untouched since merge-base at the last check.
Recommended merge proposal Merge as-is; both tests pass. Anvil also confirmed that an explicit mismatch sends no transaction.
Actual merge proposal Soon
Pending proposal None.
Local merge conflict No
GitHub merge conflict No

Documentation/technical/contracts/DINTaskCoordinator.md

Field Value
Change Modified
Lines +2/-2
Diff Replaces the stale deployment caveat and documents automatic token setup.
Functionality — how & why How: Describes the current constructor, default ID, and approval-order warning. Why: Aligns documentation with the deployment command.
Diff vs current develop HEAD Untouched since merge-base at the last check.
Recommended merge proposal Merge as-is; consistent with implementation and observed Anvil behavior. Docs CI passes.
Actual merge proposal Soon
Pending proposal None.
Local merge conflict No
GitHub merge conflict No

Documentation/technical/contracts/DINTaskAuditor.md

Field Value
Change Modified
Lines +1/-1
Diff Replaces the stale constructor caveat with current deployment behavior.
Functionality — how & why How: Documents the three-argument constructor, coordinator-derived ID, mismatch refusal, and token-before-pairing ordering. Why: Aligns documentation with the deployment command.
Diff vs current develop HEAD Untouched since merge-base at the last check.
Recommended merge proposal Merge as-is; consistent with implementation and observed Anvil behavior. Docs CI passes.
Actual merge proposal Soon
Pending proposal None.
Local merge conflict No
GitHub merge conflict No

Verification

CI is green at 24be72b. Independent focused tests report 43 passed, and the actual deployment/reward-funding smoke run on remote Anvil reports 21 checks passed. No code changes or additional verification are requested for this deployment scope.

@Santiagocetran Santiagocetran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified 24be72b: CI is green, 43 focused tests pass, and a fresh Anvil run passed 21 checks covering actual CLI deployments, token setup, matching model IDs, contract pairing, mismatch refusal, and reward funding. The auditor’s coordinator-derived model-ID default is justified. No actionable findings; approve as-is.

@Santiagocetran
Santiagocetran added this pull request to the merge queue Nov 6, 2026
Merged via the queue into InfiniteZeroFoundation:develop with commit ad94870 Nov 6, 2026
4 checks passed

Copy link
Copy Markdown
Collaborator

Post-merge CI passed on develop at ad94870 — Python, Solidity, Docs, and CI OK are all green. CI run. Thanks, Umer! 🙂

@umeradl

umeradl commented Nov 7, 2026

Copy link
Copy Markdown
Member

Actual outcome — PR #314 merged as-is (pushed)

This supersedes the pre-merge review comment above with what actually happened.

One commit on origin/develop:

  1. ad94870: real merge of this PR (merge commit, not squash), parents 1d3b484 (develop) + 24be72b (PR head, the reviewed SHA). No conflicts, matching the prediction. GitHub agrees: PR shows MERGED.

No deviation commit was needed.

Files unchanged from the PR (5 of 5)

git diff 24be72b ad94870 over the five files is empty, so every file landed exactly as authored:

  • dincli/cli/modelownerd/deploy.py
  • tests/test_deploy_task_contracts.py
  • tests/test_task_auditor_model_id_guard.py
  • Documentation/technical/contracts/DINTaskCoordinator.md
  • Documentation/technical/contracts/DINTaskAuditor.md

None of the five has been touched on develop since the merge.

Verification

Post-merge checks on ad94870 are all green: Python, Solidity, Docs, CI OK, and CodeQL (Python, JS/TS) (CI run). Pre-merge evidence is in the review comments above: 43 focused tests passed, plus a 21-check Anvil deployment/reward-funding smoke run.

Local vs. GitHub agree: clean merge, as both predicted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants